package main

import (
	"fmt"
)

func main() {
	m1 := make(map[string]string, 10)
	m1["k1"] = "v1"
	fmt.Printf("%v\n", m1)

	k := "k2"
	v, get := m1[k]
	if get {
		fmt.Printf("%v\n", v)
	} else {
		fmt.Printf("cannot find key:%v\nvalue is '%v', type is %T\n", k, v, v)
	}

	m1["k2"] = "v2"

	fmt.Println("in m1")
	for k, v := range m1 {
		fmt.Printf("\tkey: %v, value:%v\n", k, v)
	}

	m2 := map[string]string{
		"k1": "v1",
		"k2": "v2",
	}
	m2["k3"] = "v3"
	fmt.Printf("%v\n", m2)

	m3 := map[string]map[string]string{
		"ok1": {
			"k11": "v11",
			"k12": "v12",
		},
		"ok2": {
			"k21": "v21",
			"k22": "v22",
		},
	}
	fmt.Printf("%v\n", m3)

	m4 := make(map[string]map[string]string, 10)
	m4["outer_key1"] = make(map[string]string)
	m4["outer_key1"]["inner_key1"] = "value1"
	m4["outer_key1"]["inner_key2"] = "value2"
	m4["outer_key2"] = make(map[string]string)
	m4["outer_key2"]["inner_key1"] = "value1"
	fmt.Printf("%v", m4)
}
